package com.zhou.common.lib.util;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

@Slf4j
public class MyFileUtils extends FileUtils {

    public MyFileUtils() {
        super();
    }

    /**
     * org.apache.commons.io.FileUtils
     *
     * @param content
     * @param filePath
     */

    public static void fileWriter(byte[] content, String filePath) {
        File imageFile = new File(filePath);
        //创建输出流
        FileOutputStream outStream = null;
        try {
            outStream = new FileOutputStream(imageFile);
            //写入数据
            outStream.write(content);
        } catch (Exception e) {
            log.error("", e);
        } finally {
            try {
                outStream.close();
            } catch (IOException e) {
                log.error("outStream 关闭失败", e);
            }
        }

    }
}
